WR3380 communication driver

 

WR3380 communication driver is the driver to communicate with WR-3380 lighting controller of National Co. in Japan.

 

1. Read settings

 

<Figure 1> is read setting example of WR-3380 communication driver.

<Figure 1> Read setting example of WR-3380 communication driver

Device part of  <Figure 1> input Com Port(COM1), Baud Rate(9600), Parity Bit(0), Data Bit(8), Stop Bit(1) respectively according to setting of controller.

WR3380 ( National ) controller have 4 digital output switch channel which is  called the T/U.

Address of T/U can set by switch, also can be read 64 T/U( 256 channel ) at a time.

You can set 'waiting time of write after'( default : 500 milli second ), 'weather to receive of response data at indivisual data writing'( 0 = receive, 1 = don't receive, default : 1) by using option part. Each argument  is a comma-delimited.

 

WR-3380 communication driver¡¯s read schedule

Read schedule setting parameters are as follows:

1) STATION – don't care.

2) Read data type – data type. ( refer to <Table 1> )

G : read of group status detail,

g : read of group status,

TP : read of total pattern detail,

tp : read of total pattern,

FP : read of floor pattern status detail,

fp : read of floor pattern status,

E, e : read of error status,

ES, es : read of error status reset,

RTP, rtp : read of total pattern setting,

RFP, rfp : read of floow pattern setting,

RG, rg : read of group setting,

S : read of relay detail,

 s, ... : read of relay data. 

3) Read T/U address – read T/U address. ( T/U address can set by switch )

4) Save Start Address for Communication Server – readed data saving start address of communication server.

5) Read Size – 1 ~ 64 T/U size. ( 1 T/U = 4 bit data )

 

Read schedule example)

READ,  0,   s,  0,    0,  10,

READ,  0,   g,  0,   10,  4,

READ,  0,  tp,  0,   15,  4,

READ,  0,  fp,  0,   20,  4,

 

Status value of relay, pattern, group save 0, 1, 2, 3 bit( On/Off status) at each WORD memory. 

Readed value of detail status for G(group), TP(total pattern), FP(floor pattern), S(relay) save as follows :

On/Off status value save 0, 1, 2, 3 bit at each WORD memory.

8, 9 bit – pattern number for 1st switch. (0 ~ 3 , default : 0)

A, B bit – pattern number for 2nd switch. (0 ~ 3 , default : 1)

C, D bit – pattern number for 3rd switch. (0 ~ 3 , default : 2)

E, F bit – pattern number for 4th switch. (0 ~ 3 , default : 3)

 

<Table 1> is data type and contents for WR-3380 communication driver.

<Table 2> is data saving address and contents for err status read command.

Data type

Contetns

Remarks

G

read of group status detail

group

g

read of group status

TP

read of total pattern detail

pattern

tp

read of total pattern

FP

read of floor pattern status detail

fp

read of floor pattern status

E, e

read of error status

error status,

reset

ES, es

read of error status reset

RTP, rtp

read of total pattern setting

group/pattern setting

status

RFP, rfp

read of floow pattern setting

RG, rg

read of group setting

WTP, wtp

write of total pattern setting data

write command

(group/pattern Setting)

WFP, wfp

write of floow pattern setting data

WG, wg

write of group setting data

S

read of relay detail

relay

s, ...

read of relay data

<Table 1> Data type and contents for WR3380 communication driver
Data saving address Contents

Remarks

Start addr + 0 error stauts

0 : normal, 1 : error

Start addr + 1 error code

when error status,

contents of error : refer to WR-3380

user manual

Start addr + 2  H Data error
Start addr + 3  L Data error
<Table 2> Data saving address and contents for err status read command

Note) Driver for WR-3380 lighting controller have DLL-WR3380 and WR3380. WR3380 communication driver support read/write for relay data.

 

2. Write settings

You can control WR-3380 controller by using write settings.

 

Digital Write

Digital write setting parameters are as follows:

1)  PORT                   Port no. (0 ~ 255)

2)  STATION             don't care.

3)  ADDRESS           writing T/U address. higher 3 digi = writing address, lower 1 digit = 0 ~ 3 switch or pattern address.

example) 0011: 1 st T/U, 1( 2nd ) channel.

4) Extra1                    read/write command. ( refer to <Table 1> )

G, g : write of group,

TP, tp : write of total pattern,

FP, fp : write of floor pattern,

E, e : read of error status,

ES, es : write of error status reset,

RTP, rtp : read of total pattern setting,

RFP, rfp : read of floow pattern setting,

RG, rg : read of group setting,

WTP, wtp : write of total pattern setting,

WFP, wfp : write of floow pattern setting,

WG, wg : write of group setting,

S, s : write of relay.

5) Extra2                    readed data saving start address or setting file number.

RTP, rtp, RFP, rfp, RG, rg, E, e write command : readed data saving start address of WORD memory,

WTP, wtp, WFP, wfp, WG, wg write command : 00 ~ 99 setting file number.

 

Write example 1)

PORT:0,  station:0, ADDRESS:0000, Extra1: ,  Extra2 : 0

The setting parameter shown above is relay control( On/Off ) example for 0 T/U, 0 ( 1st ) channel address.

 

Write example 2)

PORT:0,  station:0, ADDRESS:0001, Extra1: G,  Extra2 : 0

The setting parameter shown above is group control( On/Off ) example for 1 ( 2nd ) group switch address.

 

Write example 3)

PORT:0,  station:0, ADDRESS:0012, Extra1: TP,  Extra2 : 0

The setting parameter shown above is total pattern setting example for 1 ( 2nd ) address 2 ( 3rd ) pattern address.

 

Write example 4)

PORT:0,  station:0, ADDRESS:0031, Extra1: RG,  Extra2 : 100

The setting parameter shown above is read setting example for 3 ( 4th ) address 1 ( 2nd ) group setting.

After reading, the readed data save at 100 ~ 172 WORD memory.

In the above example, the communication OK status save at 100 ( when OK = 1, error = 0 ) WORD memory,

101 ~ 164 WORD : 64 x 4 = 256 relay status, ( when communication OK )

165 ~ 172 WORD :  8 x 4 = 32 relay setting status. ( when communication OK )

 

Write example 5)

PORT:0,  station:0, ADDRESS:0010, Extra1: RTP,  Extra2 : 200

The setting parameter shown above is read setting example for 1 ( 2nd ) address 0 ( 1st ) total pattern setting.

After reading, the readed data save at 200 ~ 272 WORD memory.

In the above example, the communication OK status save at 200 ( when OK = 1, error = 0 ) WORD memory,

201 ~ 264 WORD : 64 x 4 = 256 pattern status, ( when communication OK )

265 ~ 272 WORD :  8 x 4 = 32 pattern setting status. ( when communication OK ) 

 

Write example 6)

PORT:0,  station:0, ADDRESS:0001, Extra1: WG,  Extra2 : 0

The setting parameter shown above is group writing example.

Group switch setting data get from ¡®work folder\SCAN\GROUP_00_000.INI¡¯ file. The group switch setting data = 72 x 4 Group switch setting.  ( refer to <Table 3> )

 

Write example 7)

PORT:0,  station:0, ADDRESS:0000, Extra1: WTP,  Extra2 : 1

The setting parameter shown above is total pattern writing example.

Total pattern setting data get from ¡®work folder\SCAN\PATTERN_01_000.INI¡¯ file. The total pattern setting data = 72 x 4 Pattern setting.  ( refer to <Table 3> )

 

Command filename

Remarks

Total Pattern work folder\\SCAN\T_PATTERN_??_xxx.INI

?? : 00 ~ 99 number of Extra2.

xxx : 000 ~  number of Port.

Floor Pattern work folder\\SCAN\F_PATTERN_??_xxx.INI
Group work folder\\SCAN\GROUP_??_xxx.INI
<Table 3> Command and filename for write setting

Setting data input method for Total Pattern, Floor Pattern, Group

1. Input all data by decimal unit.

2. Each argument is a comma-delimited.

3. Input 4 switch data at a line.

4. Change the line for other switch data.

5. Input 72 T/U data or 24 x 3 floor pattern data. Total Pattern, Group : 72 x 4 = 288 data,   Floor Pattern : 24 x 3 = 72 data.

 

Analog Write

Analog write and digital write have the same setting parameters except output value.

 

Note) Please connect full RS-232C communication cable to communicate with WR3380 controller. ( refer to WR3380 user manual )

 

Script example for group setting)

Script example for group setting is as follows : ( assume : for group setting 256 + 32 relay ¡¦)

 

handle  = @FileOpen("F:\\AUTODEMO\\WR3380\\SCAN\\GROUP_00_000.INI", "w");   // set to Port - 0, EXTRA2 - 0

 

if(handle != 0) {

   for(j = 0; j < 72; j = j+1) {

      for(i = 0; i < 4; i = i+1) {

         val[i] = 0;

         k = 0;

         pos = (j*4)+i+1;

         @sprintf(buf, "wDi%02d", pos);   // group set/don't set digital tag - wDi00 ~ wDi287

         l =  @GetTagValue(buf);

         if(l==1) k = 8;

 

         @sprintf(buf, "wData%02d", pos);   // group switch number setting analog tag - wData00 ~ wData287

         l = @GetTagValue(buf);

 

         val[i] = k+l;

      }

      @sprintf(buf, "%02d,%02d,%02d,%02d,\r\n", val[0],val[1],val[2],val[3]);

      @FileWrite(handle, buf, 14);

   }

   @FileClose(handle);

   $DO_0001 = ON;            // group writing, set to Port - 0, EXTRA2 - 0

}